<template>
  <div class="app-container">
    <el-form
      :inline="true"
      ref="ruleForm"
      :model="formInline"
    >
      <el-form-item label="操作端" prop="osType">
        <el-select v-model="formInline.osType" placeholder="请选择操作端">
          <el-option
            v-for="item in consts.PAYMENT_PLATFORM"
            :label="item.title"
            :key="item.value"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="账户类型" prop="userType">
        <el-select
          v-model="formInline.userType"
          placeholder="请选择账户类型"
        >
          <el-option
            v-for="item in payEnum.USER_TYPE"
            :label="item.title"
            :key="item.value"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="账户名" prop="userName">
        <el-input v-model="formInline.userName" placeholder="请输入"></el-input>
      </el-form-item>
       <el-form-item label="三方支付平台名称" prop="channelId">
        <el-select v-model="formInline.channelId" placeholder="请选择商户">
          <el-option
            v-for="item in channelList"
            :label="item.channelName"
            :value="item.channelId"
            :key="item.channelId"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="商户号" prop="merchantCode">
        <el-input v-model="formInline.merchantCode" placeholder="请输入"></el-input>
      </el-form-item>
      <el-form-item label="异常状态" prop="errorStatus">
        <el-select v-model="formInline.errorStatus" placeholder="请选择商户">
          <el-option label="全部" :value="-1"></el-option>
          <el-option label="系统-订单创建失败" :value="0"></el-option>
          <el-option label="三方-订单创建失败" :value="1"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="充值时间" prop="time">
        <el-date-picker
          v-model="formInline.time"
          type="datetimerange"
          align="right"
          unlink-panels
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="['00:00:00', '23:59:59']"
          value-format="yyyy-MM-dd HH:mm:ss"
          :picker-options="pickerDayStep">
        </el-date-picker>
      </el-form-item>

      <el-button
        class="filter-item"
        type="primary"
        icon="el-icon-search"
        @click="onClickSearch"
      >
        搜索
      </el-button>
      <el-button @click="onClickResetForm('ruleForm')">重置</el-button>
    </el-form>
  </div>

</template>

<script>

// services
// import { getRechargeShopDetail } from '@/services/api/withdraw';
import { getPaymentManageChannelList } from '@/services/api/recharge';

// mixins
import { form, grid, pickerOption } from '@/build';

export default {
  name: 'form-filter',
  mixins: [form, grid, pickerOption],
  data() {
    return {
      auditApplyList: [],
      levelList: [],
      channelList: [],
      groupList: [],
      formInline: {
        osType: -1,
        time: [moment().format('YYYY-MM-DD 00:00:00'), moment().format('YYYY-MM-DD 23:59:59')],
        userType: -1,
        userName: null,
        channelId: -1,
        merchantCode: null,
        errorStatus: -1,
      },

    };
  },
  methods: {
    onClickSearch() {
      this.$emit('on-filter', this.formInline);
    },
    onClickResetForm(formName) {
      this.resetForm(formName);
      this.onClickSearch();
    },
  },
  mounted() {
    // this.bindGet(getRechargeShopDetail, 'rechargeShopList', { });
    this.bindGet(getPaymentManageChannelList, 'channelList', {
      format: (data) => {
        data.unshift({ channelId: -1, channelName: '全部' });
        return data;
      },
    });
    this.getAll();
  },
};
</script>

<style lang="scss" scoped>
  .with-pre-select {
    .el-input-group__prepend {
      .el-select {
        width: 120px;
      }
    }
  }

  .money-range {
    .el-input {
      width: 100px;
    }
  }

</style>
